from socket import *

HOST = 'localhost'
PORT = 2456
BUFSIZE = 1024
ADDR = (HOST, PORT)

udpSocket = socket(AF_INET, SOCK_DGRAM)

while True:
    data = raw_input('> ');

    if not data:
        break
    udpSocket.sendto(data, ADDR)

    data, addr = udpSocket.recvfrom(BUFSIZE)
    if not data:
        break
    print data

udpSocket.close()
    
    
